<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    /* 
      思路：https://leetcode-cn.com/problems/climbing-stairs/solution/hua-jie-suan-fa-70-pa-lou-ti-by-guanpengchn/
     */
    let n = 3;

    function climbStairs(n) {
      let dp = [1, 1];
      for (let i = 2; i <= n; i++) {
        dp[i] = dp[i-1] + dp[i-2];
      }

      return dp[n];
    }
    console.log(climbStairs(n));
  </script>
</body>
</html>